﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace Adams.Web.Data.Security
{
    public static class Signup
    {
        public static void SaveMember(Models.Security.Signup.SaveData input)
        {
            DB.RunScalar(@"
INSERT INTO Membership.Members (FirstName, LastName, Email, Street, Street2, City, State, ZipCode, Phone, PasswordHash, PasswordSalt, IsActive, IsLocked)
VALUES (@FirstName, @LastName, @Email, @Street, @Street2, @City, @State, @ZipCode, @Phone, @PasswordHash, @PasswordSalt, 0, 0)
", CommandType.Text,
                DB.CreateParameter("@FirstName", input.FirstName.ToNString()),
                DB.CreateParameter("@LastName", input.LastName.ToNString()),
                DB.CreateParameter("@Email", input.Email.ToNString()),
                DB.CreateParameter("@Street", input.Street.ToNString()),
                DB.CreateParameter("@Street2", input.Street2.ToNString()),
                DB.CreateParameter("@City", input.City.ToNString()),
                DB.CreateParameter("@State", input.State.ToNString()),
                DB.CreateParameter("@ZipCode", input.ZipCode.ToNString()),
                DB.CreateParameter("@Phone", input.Phone.ToNString()),
                DB.CreateParameter("@PasswordHash", input.PasswordHash.ToNString()),
                DB.CreateParameter("@PasswordSalt", input.PasswordSalt.ToNString()));
        }
    }
}
